# Maintainer: Laurent Bercot <ska-devel@skarnet.org>
# Contributor: Laurent Bercot <ska-devel@skarnet.org>
#
# NOTE: For now this APKBUILD is pure mechanism.
# A later version of the APKBUILD will install mdevd as device manager,
# replacing busybox mdev.
pkgname=mdevd
pkgver=0.1.1.2
pkgrel=0
pkgdesc="A netlink-listening device manager similar to mdev"
url="https://skarnet.org/software/mdevd/"
arch="all"
license="ISC"
options="!check"  # no tests provided
makedepends="linux-headers skalibs-dev"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc"
source="https://skarnet.org/software/mdevd/mdevd-$pkgver.tar.gz
	$pkgname.initd"

build() {
	./configure \
		--enable-shared \
		--enable-static \
		--disable-allstatic
	make
}

package() {
	make install DESTDIR="$pkgdir"

	mkdir -p "$pkgdir"/usr/share/doc
	cp -a doc "$pkgdir"/usr/share/doc/$pkgname

	install -D -m 755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="7d7a25facde1291854f564e805cc2bf7e7e0b06aaa4b631a640cf999007a3ef063ec68e8973559ec69023f40bb6ed24937d4d8510fd697f34a97345a22ede5b5  mdevd-0.1.1.2.tar.gz
d579d22e0047c43b8b59c73874f28690e0b5665bbe5bf1b38ebedb1df87af601412b0afc348a1ac5d985e28f9206a7d4f97b1b714e21c8cf9461c6b96b662d95  mdevd.initd"
